package com.xindz.hgq.base.options;

import android.support.annotation.NonNull;

import com.kingja.loadsir.callback.Callback;
import com.xindz.hgq.base.MvpInterface;

/**
 * @name HGQBase
 * @class name：com.xindz.hgq.base
 * @describe 公共配置 是否开启MVP 是否开启LoadSir
 * @anthor XINDZ
 * @time 2018/1/4 11:20
 * @change
 * @chang time
 * @class describe
 */
public class BaseOptions<B extends BaseOptions> {

    /**
     * 是否开启MVP模式
     */
    private boolean isOpenMVP = false;
    /**
     * 如果开启MVP 需要给赋值
     */
    private MvpInterface mvpInterface;

    public MvpInterface getMvpInterface() {
        return mvpInterface;
    }

    public boolean isOpenMVP() {
        return isOpenMVP;
    }

    public B openMVP(@NonNull MvpInterface mvpInterface) {
        this.isOpenMVP = true;
        this.mvpInterface = mvpInterface;
        return (B) this;
    }

    /**
     * 是否开启加载
     */
    private boolean isOpenLoadSir = false;


    public boolean isOpenLoadSir() {
        return isOpenLoadSir;
    }

    private Callback.OnReloadListener loadSirListener;

    public Callback.OnReloadListener getLoadSirListener() {
        return loadSirListener;
    }

    /**
     * 开启LoadSir 需要传入ReLoad的Listener
     *
     * @param loadSirListener
     * @return
     */
    public B openLoadSir(@NonNull Callback.OnReloadListener loadSirListener) {
        this.isOpenLoadSir = true;
        this.loadSirListener = loadSirListener;
        return (B) this;
    }
}
